#ifndef _MAIN_H_
#define _MAIN_H_

#if BUFFER_SIZE < 256
	typedef unsigned char frameindex_t;
#else
	typedef unsigned int frameindex_t;
#endif

#if MEM_SIZE < 65536
	#define BOOTFLASH __flash
	#define APPFLASH __flash
#else
	#define BOOTFLASH __farflash
	#define APPFLASH __hugeflash
#endif

#ifndef outb
	#define	outb(addr, data)	addr = (data)
#endif
#ifndef inb
	#define	inb(addr)			(addr)
#endif
#ifndef BV
	#define BV(bit)			(1<<(bit))
#endif
#ifndef cbi
	#define cbi(reg,bit)	reg &= ~(BV(bit))
#endif
#ifndef sbi
	#define sbi(reg,bit)	reg |= (BV(bit))
#endif
#ifndef cli
	#define cli()			__asm__ __volatile__ ("cli" ::)
#endif
#ifndef sei
	#define sei()			__asm__ __volatile__ ("sei" ::)
#endif
#ifndef bit_is_clr
	#define bit_is_clr(val) bit_is_clear(val)
#endif

#endif
